package com.band.exception;

import com.band.entity.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(ClazzStatuException.class)
    public Result doClazzStatu(ClazzStatuException e){
        log.error(e.getMessage());
        return Result.error("对不起, 该班级下有学生");
    }
    @ExceptionHandler(Exception.class)
    public Result doException(Exception e){
        log.error(e.getMessage());
        return Result.error("操作异常,请联系管理员");
    }
}
